package com.henry.others;

import java.sql.*;
import java.util.Scanner;

public class JDBCMySQLVersion {

    public static void main(String[] args) {
        
        Scanner keyboard = new Scanner(System.in);

        String url = "jdbc:mysql://localhost:3306/testdb?useSSL=false";
        String user = "root";
        String password = keyboard.next();
        
        Connection con;
        Statement st;
        ResultSet rs;

        String query = "SELECT VERSION()";

        try {
            con = DriverManager.getConnection(url, user, password);
            st = con.createStatement();
            rs = st.executeQuery(query);

            if (rs.next()) {
                System.out.println(rs.getString(1));
            }
        } catch (SQLException throwable) {
            throwable.printStackTrace();
        }

        keyboard.close();
    }
}
